package com.oracle.oa.action;

import java.util.List;
import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;
import org.hibernate.criterion.DetachedCriteria;

import com.opensymphony.xwork2.ActionSupport;
import com.oracle.oa.biz.UserInfoBiz;
import com.oracle.oa.entity.Departinfo;
import com.oracle.oa.entity.Userinfo;
import com.oracle.oa.util.PageBean2;

public class SplipageAction2 extends ActionSupport implements SessionAware {

	private int type = 1;// 接请求中的类类型
	private String result;// 封装跳转结果
	private String page = "1";
	private String sss;
	UserInfoBiz ubiz;
	Map<String, Object> session;
	
	
	
	@Override
	public String execute() throws Exception {
		DetachedCriteria dc = null;
		Class clz=null;
		PageBean2 p=new PageBean2();
		result="admin_cg/zhk/showUserInfo.jsp";
		clz=Userinfo.class;
		dc=DetachedCriteria.forClass(clz);
//		List<Userinfo> list=ubiz.getAll(Userinfo.class);
//		session.put("userinfoList", list);
//		return SUCCESS;
		ubiz.fenye(dc, p, clz);
		int current = 1;
		if (page != null) {
			current = Integer.parseInt(page);
			if (current < 1)
				current = 1;
			if (current > p.getTotalPage())
				current = p.getTotalPage();

			p.setCurrentPage(current);
			ubiz.fenye(dc, p,clz);
		}
		session.put("p", p);
		if (type==1) {
			sss="111";
		}else if (type==2) {
			sss="222";
		}else if (type==3) {
			sss="333";
		}	
		
		return sss;
		
	}
	
	public void setSession(Map<String, Object> arg0) {
		this.session=arg0;
	}

	public UserInfoBiz getubiz() {
		return ubiz;
	}

	public void setubiz(UserInfoBiz ubiz) {
		this.ubiz = ubiz;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public String getPage() {
		return page;
	}

	public void setPage(String page) {
		this.page = page;
	}

	public UserInfoBiz getUbiz() {
		return ubiz;
	}

	public void setUbiz(UserInfoBiz ubiz) {
		this.ubiz = ubiz;
	}

	public String getSss() {
		return sss;
	}

	public void setSss(String sss) {
		this.sss = sss;
	}
	
}
